package com.ltd.fragmentdemo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;

import java.util.List;

/**
 * Created by chinalin on 2017/5/9.
 */

public class MyFragmentStatePagerAdapter extends FragmentStatePagerAdapter {
    private String[] tabTilte;

    private List<Fragment> listFragment;
//    public MyFragmentStatePagerAdapter(FragmentManager fm, String[] tabTitle) {
//        super(fm);
//        this.tabTilte = tabTitle;
//    }
    public MyFragmentStatePagerAdapter(FragmentManager fm,List<Fragment> listFragment) {
        super(fm);
        this.listFragment = listFragment;
    }

    @Override
    public Fragment getItem(int position) {
        return listFragment.get(position);
/*        switch (position) {
            case 0:
                return new VPFragment1();
            case 1:
                return new VPFragment2();
            case 2:
                return new VPFragment3();
        }
        return null;*/
    }

//    @Override
//    public int getCount() {
//        return tabTilte.length;
//    }
    @Override
    public int getCount() {
        return listFragment.size();
    }
}
